#ifndef _MATERIALEDITORWIDGET_H_
#define _MATERIALEDITORWIDGET_H_
#include <SEUi/Widget/Widget.h>
#include <SERender/Resourses/Material.h>
#include <SECore/Signal.h>
#include <SECore/ResourcePayload.h>

namespace SEngine
{
    class EditLayer;
    class Actor;
    class MaterialEditorWidget : public Widget
    {
    public:
        MaterialEditorWidget(EditLayer &);
        virtual ~MaterialEditorWidget() = default;
        void LoadMaterial(ResRef<Material> material);
    protected:
        virtual void BeginUpdate() override {}
        virtual void UpdateImpl(int delta) override;
        virtual void EndUpdate() override {}
    private:
        void MaterialAttribute();
        void ReloadMaterial();
        void SaveMaterial(const std::string & path);
        void LoadShader(ResRef<Shader> shader);
        void ReloadShader();
        void ShaderAttribute();

    public:
        Signal<ResRef<Material>> SignalLoadMaterial;

    private:
        EditLayer & m_layer;
        char m_materialPathBuffer[256]{0};
        char m_shaderPathBuffer[256]{0};
        ResRef<Material> m_material;
        // std::shared_ptr<Material> m_DefaultMaterial;
        
    };
} // namespace SEngine


#endif